<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>剪绳子 II</title>
</head>
<body>
  <!-- 思路：暴力方法 -->
  <script>
    function fn(num) {
      if (num <= 3) return num - 1;
      let res = 1;
      while (num > 4) {
        res = (res * 3) % 1000000007;
        num -= 3;
      }
      return (res * num) % 1000000007;
    }
    console.log(fn(10))
  </script>
</body>
</html>